Repository navigation
11.0.0-rc.1: LibRed comparisons, typing and dates held to ACE, one implementation of every function, DDL and DELETE rules, password-protected files and view scaffolding - #311
Open
ChrisJollyAU wants to merge 65 commits into
Conversation
ExecuteJoin materialised and filtered its whole right side as soon as the join was set up, before any left row existed. A predicate on the right side was therefore evaluated even when the left side had no rows, and one that fails on a row (a text column compared with a number, on an empty string) aborted a query whose answer is no rows. ACE does not reach it: linq2db's Issue2608 statement, a five-way self-join whose first table's predicates contradict each other, returns no rows on ACE (measured over OLE DB), while LibRed threw a type mismatch from the last table's NOT IN. The right side is now read at the first left row and reused for the rest, as the index-seek arm of the same method already defers its inner side. A RIGHT or FULL join still reads it after the loop when no left row came, so its unmatched rows are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e a Null meets one that is Measured against ACE through one script run on both engines; BooleanValueParityAccessTests holds LibRed to the same answers. A Boolean bound for a column that is not Yes/No is the Int16 -1 or 0 and from there that number: True stores 255 in a BYTE (it threw OverflowException), and a Yes/No column retyped by ALTER COLUMN becomes -1, not 1, leaving its index keys agreeing with its rows. A Boolean parameter under a declared DbType reaches the engine converted to that type, as the OLE DB client converts it: 1 under Int16, "True" under String, and refused under the types that client cannot convert a Boolean to. A Null written to a Yes/No column is False before a required column, an index or a CHECK sees it, and the column is not nullable in the Columns rowset, INFORMATION_SCHEMA and what the scaffolder reads - while a reader's schema calls it nullable, as ACE's does. In the rows a query returns, a Yes/No column from an outer join's unmatched side reads False; WHERE, aggregates, UNION and INSERT ... SELECT still see the Null, and grouping by it is refused. Comparisons follow ACE's choice of what is looked up. `col = True` is a truth test and is not answered by an index seek. A value looked up in a Yes/No column - by a join's inner table, by EXISTS, IN or = ANY, or by any comparison answered from an index the column leads - is taken by its truth; a Decimal column and a written Decimal stay numbers. A text column beside a number the statement computes compares as text, a GUID or binary value sorts below a computed number, and text beside a Yes/No column is a type mismatch. A number stored into a binary column is its own bytes and a Long stored into a GUID column its first four, by INSERT, UPDATE, DEFAULT and ALTER COLUMN alike. A DEFAULT its column cannot take is refused when it is declared rather than when a row first needs it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ted in schema A comparison is answered by the index rule - the value converted as storing it would, a Yes/No column by its truth - only where ACE reads the column's table through an index. Which side of a join that is, is decided once per join from the measured rule: lookup-able sides, a restriction an index answers, row counts and what is read above the join. On the looked-up side a number or Yes/No column is compared on the fetched row as written. A LEFT JOIN whose WHERE compares a column of its optional table is planned as the inner join it is. SELECT, UPDATE and DELETE share the one placement and the one seek chooser. The storing conversions live in JetTypeCodec; the comparison rules between kinds in one place in the evaluator. A subquery is decorrelated only where the per-row form would answer the same. A calculated column reports its result type and nullability as ACE's schema rowsets do. A reader's AllowDBNull follows ACE with and without KeyInfo. A Boolean parameter's conversion feeds its Size clip. CLAUDE.md and AGENTS.md: a duplicate is removed, never noted. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A Currency's storing guard lives in JetTypeCodec.CurrencyAsStored, which its three callers each wrote. A join's column equalities are resolved once and passed on. The resolved column, the column pair and the column restriction are each one named type where a tuple was spelled out at every use. A subquery's lookup plans have their own dictionary in place of a composite key and its comparer. The evaluator asks one cache whether an expression is a Currency, and states each mirrored comparison rule once. No behaviour changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Single Arithmetic on Doubles that leaves the Double range is an Overflow error, as ACE gives, where it returned infinity. A Single result past the Single range is an Overflow error too: ACE widens such a result to a Double, but LibRed keeps the Single the operands declare, so it refuses rather than widen. Timer is a Single, as in ACE, where it was a Double. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y column A multi-column IGNORE NULL index left out every row with a Null in any key column. ACE leaves out only a key Null in all of them: a partly-Null key is held in the B-tree, still exempt from uniqueness, so a UNIQUE IGNORE NULL index accepts (1, Null) twice. Insert, update, delete, CREATE INDEX's back-fill and ALTER COLUMN's rebuild all ask one rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Jet 4 file's database password was never checked: LibRed opened a protected .mdb with no password or the wrong one. It now compares the stored password exactly, as ACE does, and refuses with "Not a valid password." The stored password is read by the inverse of the code that writes it, which the SID keystream now uses too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The connection string takes the database password as Password, and still reads ACE OLE DB's "Jet OLEDB:Database Password" and ODBC's PWD. LibRedConnectionStringBuilder.Parse is the one parse every caller uses, the scaffolder included, and returns the canonical Data Source (as a full path) and Password keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ACE will not drop or rename a table another table's CHECK reads, nor drop, rename or alter a column any CHECK reads, and names the earliest-created such check. LibRed allowed all of them, leaving a check over a table or column that was gone. What a check reads is taken from its MSysObjects.Database. The refusals come in ACE's order, after the relationship and index refusals; SET/DROP DEFAULT and Required are not held. A column renamed to its own name, or by case only, is no longer a collision with itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s as ACE does An unnamed foreign key is named Rel_ and the first three groups of a fresh GUID, as ACE names it, so two between one pair of tables, or one between two 60-character tables, are created instead of refused. A DELETE runs in ACE's sequence. The roots go in the order read, and for each row its relationships in turn: a CASCADE deletes the children then, depth first, a SET NULL nulls them, and a NO ACTION refuses while a child the statement has not yet deleted holds the row, in ACE's words for a cascade when one reached the parent. A child an earlier rule detached is not cascaded to, and a root a cascade already deleted fails with "Record is deleted.". No row goes until every check has passed. A Null a cascade writes into a required column is refused in ACE's words for a cascade. A DELETE with no WHERE of a table only its own relationships reference, and no CHECK, empties it in one go, as ACE does; with a CHECK it goes row by row under the rules. A table's relationships are applied in the stored order of its incoming blocks, not MSysRelationships row order, so one dropped and added again keeps its turn. LogicalIndexDef is now a view over the block it was read from. CREATE TABLE numbers a self-reference's incoming block straight after its outgoing one, and writes relationship and CHECK objects in the order the statement declares them, both as ACE does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erals as ACE does A Double or Single becoming a Currency was first cut to its 15 (or 7) significant digits; ACE takes its exact binary value, rounded half to even. Storing, CCur, ALTER COLUMN, a calculated Currency column and Currency plus or less a Double, Single or text now all go through the codec's one conversion. A calculated Currency over a Decimal or text takes that value exactly. A Decimal past a Currency now gives the same overflow message as a Double. A number written with a point and no exponent whose whole part ends in a zero (10.0, 20.) is a Double, as ACE types it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The VBA functions Core's calculated-column evaluator already has now carry LibRed.Engine's logic: Trim, Choose, Left, Right, Mid, Space, Asc and String in the ANSI code page, Str, the math functions, Round, IIf's condition, Weekday, DateSerial, TimeSerial, MonthName, WeekdayName, InStr's arguments, and the ten financial functions as the VBA runtime computes them. CLAUDE.md makes keeping the two evaluators' functions in sync a hard rule, and a hook reminds on every edit to either file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ACE's textual search does not use the collation: case folds by LIKE's fold table, and ß, æ, œ and þ are spelt out by locale, so trailing spaces, hyphens and apostrophes are no longer ignored. TextFold in LibRed.Core carries the fold (and the LikeFold resource moves with it), so the engine and calculated columns search the same way. The compare argument resolves as ACE does, an absent one taking the database's locale, which now reaches calculated columns through Table and RowInserter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The VBA/Access and SQL functions, and the arithmetic and comparison under the operators, now live once in Core's ExpressionFunctions, moved from LibRed.Engine's ExpressionEvaluator as the engine had them. The engine's evaluator derives from it over the SQL tree, and the calculated-column evaluator over a column's expression, so a formula answers the same through SQL and through a calculated column. The calculated-column evaluator keeps only what ACE refuses there: its function whitelist, the '$' names, the argument counts it accepts and the Null arguments whose cached error ACE cannot read back. There is one LikeMatcher, which takes ANSI-89 wildcards for a calculated column and ANSI-92 for a query. A calculated column's text compares in the database's collation, which is passed down in place of its locale ID: the locale ID alone does not say which sort version the database uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th and CByte A calculated column's And, Or and Not are the query's, through the shared operator helpers: logical rather than bitwise, Null as ACE has it, and And and Or short-circuiting, so a False or True operand decides the result before the other is evaluated. An UPDATE writes every column its SET names, not only those whose value changed: each is held to its declared width, a memo or OLE value is written again with a fresh stamp, a calculated column reading it is recomputed, and Required is checked for the written columns alone. A binary value as a condition is False when it equals the text "0" in the database collation, and a GUID always True; an index seeks a column that is not true as it seeks = False. CByte gives an Integer, as ACE's does, while its column stays declared a Byte. A number a statement is passed beside a binary value compares as text, an Int64 too; a Currency passed against an indexed GUID finds no row. The close lengthens the released-pages map only when its window already reaches the lowest page released, and otherwise moves the window. The deleted engine parity tests are recreated on the engine, without LibRed.Ado, and the format docs carry the measurements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StrConv gives a String for every conversion, so its column is declared text rather than left to the first value. A calculated column cannot use StrConv or TypeName: ACE refuses both by policy, as LibRed does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A class, a negated class and a range in a calculated column store what ACE stores. The column's own Like used to escape '[', matching a class only as literal text; it has taken the query's Like since the evaluators were merged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A UNIQUE index over two columns, plain or WITH IGNORE NULL, built before or over the rows, accepts (1, Null) twice: a key with a Null part is no duplicate, and the leaf holds the same key for both rows. The test now asserts ACE's acceptance, not only that the two engines agree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The operator dispatch and the number-literal parsing are kept twice by decision, marked DELIBERATE DUPLICATE at both sites since 4355ee8; say so where the one-copy rule is stated, so a review does not flag them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arameters Text compared with a number now follows ACE's measured rules, which differ between queries and calculated columns: - In a query, text beside a number the statement computes (arithmetic, a VBA function, a written False) compares as text; a bare column, an aggregate, an IIf and a parameter compare as numbers. - In a calculated column, a number column and arithmetic beside text compare as text, an IIf takes the kind of the arm it chooses row by row, a written number beside computed text compares as a number, and a written number beside written text is a type mismatch ACE caches as an error, so LibRed refuses to write the row. IIf's arm choice now lives once, in ExpressionFunctions.IifArm, shared by the IIF function, the calculated-column comparison and the engine's span path. Text read into a Large Number or compared with a Decimal is exact rather than going through a Double; ALTER COLUMN to Large Number reads a fractional text value through a Double, as ACE does. The GUID storage cross-check tolerates the uninitialised bytes ACE 2010 and 2016 store for text that is not a GUID, and the BIGINT cases carry their ACE version guards. docs/int64-values.md records which Int64 bindings work through OLE DB, ODBC and DAO on each engine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… own index 0x0200 A cross-check of docs/format against LibRed.Core and the engine. Where the two disagreed the code was right, so the spec now says what the code does: the 255-row page cap on read, both index counts capped at 32, the in-place Memo/OLE retype, how seeks guard against cycles, which frees are immediate, the reader parsing the long-value map list, Complex as an Int32 complex id, the format raise living in Core, an object's owner being the admin account, LvProp inlined up to 64 bytes, LvExtra carrying parameter facets, a default refused when it is declared, which column flags are composed on write, and a calculated column's functions living once in ExpressionFunctions, declared in SQL as `column type AS (expression)`. Stale code comments are brought into line the same way. One difference was in the code. ACE puts 0x0200 only on the index a complex column is made with; an index created over the column afterwards is flagged as over any column (CREATE INDEX 0x0080, unique 0x0081, DISALLOW NULL 0x0088, unique DISALLOW NULL 0x0089, a foreign key's 0x0080) and takes a data block of its own. LibRed set the bit on every index that included a complex column, so a unique DISALLOW NULL one wrongly shared the column's own block. InsertIndex now takes the flag from its caller, and only AddComplexStorage sets it. ACE also accepts these indexes, where the spec said it refused them. Two simplifications: BuildColumnDescriptor writes the 4-byte marker in one write, as WriteParts does, and EncodeText drops a Math.Min that refusing an over-long fixed value had made dead. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ACE cuts every calculated Text result to the characters its constant 509-byte
declared length holds as UTF-16 past the 23-byte envelope - 243 - and cuts
before it compresses, so a result that compresses is cut too. It gives no
error, on OLE DB and DAO writes alike, on ACE 2010 and Microsoft 365. A
calculated Memo result is not cut.
LibRed stored the whole result, and ACE's OLE DB reader then refused the row
("Multiple-step OLE DB operation generated errors"). CalculatedValue.Encode
now cuts a Text result the same way, from the column's declared length.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…inst True or False as text In a query, a text column or written text beside a number, date or Boolean that the statement does not compute either - a column, a written number or True, an aggregate, an IIf choosing one - is now ACE's "Data type mismatch in criteria expression", for every comparison operator, IN, BETWEEN, HAVING and a join, with an index or without. LibRed used to read the text as a number instead. That was left over from when the comparison could not tell a written value from a parameter; parameters and computed values have their own measured rules now, and those are unchanged. The Yes/No check this replaces was one case of the rule. An IIf compares as the arm it takes, so IIf(q > 0, q + 0, 0) beside text compares as text where IIf(q > 0, q, 0) is the type mismatch. = or <> against the literal True or False takes text as False only when it compares equal to the text "0": '0 ' is False, while '0.0', ' 0', '00', '-0' and '' are True. Measured against ACE 2010 and Microsoft 365, which agree on all of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ACE does A VBA $ function returns a String where its plain name returns a Variant that holds one. Measured on ACE 2010 and Microsoft 365, for every function with a $ form: - A calculated column accepts a $ form exactly where it accepts the plain name - LCase, Left, Mid, Right, Space, Str, String, Trim and UCase - and computes the same value. LibRed refused every $ form there, on the belief that ACE then fails every insert; it fails only the rows where the $ form would be Null. - A String cannot hold Null, so where the plain name gives Null the $ form raises: "Invalid use of Null" for Hex$, Oct$, Str$ and String$, "Data type mismatch" for the text functions. Format$ gives "" as Format does. In a calculated column that is a row ACE refuses, and LibRed refuses the write. - Date$() and Time$() are text, mm-dd-yyyy and HH:mm:ss, whatever the locale. The behaviour lives in ExpressionFunctions.Function, so queries and calculated columns share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…as an Integer, as ACE does ACE gives each of them VBA's Integer: VarType 2, an Int16 result column. LibRed returned and declared a Long, so a model mapping a saved query's Year() column to short, as Access describes it, failed in GetInt16 (issue 309). The Long came from matching EF's DateTime.Year, but EF sends that as DATEPART, which stays a Long, and sends AscW only inside CLng. Sgn is left a Long: EF's compatible mode sends Math.Sign as SGN and reads it with GetInt32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s ACE does ACE gives Sgn VBA's Integer whatever its argument, and keeps an Integer or a Boolean an Integer through unary minus (-True is 1); a Byte column still negates to a Long. LibRed gave a Long for all of them. LibRed's SIGN extension stays a Long. JetMathTranslator now gives SGN a short type mapping, keeping Math.Sign's int as the expression type, so EF reads the Integer and widens it rather than relying on the data reader to convert. The SQL it writes is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A negative zero is "-0" as the Microsoft 365 runtime writes it and "0" as ACE 2010 writes it (Str " 0"). LibRed writes Microsoft 365's, and the calculated-column matrix now accepts it where ACE writes "0". - A calculated Text's empty payload reads "" through OLE DB and Null through DAO; a calculated Memo's reads "" through both. LibRed reads "". - Numbers as written in a calculated column are typed as a query types them: 10.0 and 3000000000.0 are Doubles, 105.0 a Long, 1.50 a Decimal. - DAO's object model writes differently from an SQL statement: it refuses a Byte past its range and excess Decimal scale, and stores any non-zero number, and 'True', in a Yes/No column as True without rounding. Measured on ACE 2010 and Microsoft 365. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uery, as a query with one ACE evaluates a CHECK that reads no table in its expression service, as it does a calculated column, and a CHECK holding a subquery as a query. The type-mismatch rule from 905a4cc applied to every CHECK, so CHECK (S > 5) refused a text '10' that ACE accepts. Without a subquery a CHECK now compares as a calculated column does: a written number beside text compares as the number the text reads as, a column beside text as its text, = True against -1 rather than as a truth test, and written False as written. LIKE still matches as a query's does. That comparison rule now lives once in ExpressionFunctions.CompareInService, which both evaluators use. With a subquery a CHECK compares as a query does, except that a subquery's value counts as a column rather than as computed: S = (SELECT MAX(N) ...) and (SELECT MAX(S) ...) > 5 are a type mismatch there, where a WHERE compares them as text and as a number. In either kind of CHECK an IN list skips a Null item, as ACE does. Queries keep their Null result. Measured against ACE. Not yet matched: ACE refuses at CREATE a CHECK whose subquery compares mismatched column types ("Syntax error in CHECK constraint clause."), and an IN list with a Null item inside a CHECK's subquery still follows the query rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ACE applies a stored default through its expression service, which compares
as it does in a calculated column; the same text in an ACE SELECT gives the
query's answer. LibRed applied defaults with the query's rules:
- IIf(2 = True, 1, 0) inserts 0, as = True compares with -1 (a query's truth
test gives 1).
- IIf(IsNull(2 IN (1, NULL)), 1, 0) inserts 0, as the IN list skips the Null
item.
- IIf('abc' <> False, 1, 0), IIf('0' <> False, 1, 0) and IIf('5' = 5, 1, 0)
are a type mismatch, and the insert taking them is refused.
A default is now worked out with the rules a CHECK that reads no table already
uses. That kind is renamed from ExpressionEvaluator.Check to Stored, since it
now covers both, and one DefaultEvaluator serves the declaration check and the
insert.
Measured against ACE, with each default stored by LibRed and applied by ACE,
since ACE's DDL refuses some of them as written. ACE's DDL refuses a default
whose comparison is a type mismatch when it is declared; LibRed still refuses
it on the insert that applies it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A subquery found to read the outer query's aliases is remembered as correlated, as one whose trial run failed already is, rather than checked again for every outer row: the subquery and the aliases around it are the same each time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ACE builds a new record with every memo or OLE value of 64 bytes or less inline and, while the record is past 4060 bytes, moves the next one still inline, in column order, to a single LVAL page, refusing the row once none is left to move. An empty value is never moved: it stays inline and the next one moves instead. LibRed refused the row as soon as the inline record was too large. An UPDATE that grows a row past the cap moves nothing and is refused, as ACE does. Measured over 135 rows, memo and OLE alike. The encodes that only measure the record stand a descriptor in for a calculated result too long to inline, so it reaches a page once, not once per value moved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The section that closes a key's kana grows with the run: 02, a 80 for every seven kana or part of seven, FF and the same 80s again, counted over the kana entries alone. LibRed always wrote one. A combining mark with no weight before it takes no position of its own, so an apostrophe after U+0301 + a sits at 0B, as after a alone. Its secondary stands in for the first weight's when that is the default (U+0301 + a is 0C) and beside it when the letter has an accent of its own (U+0301 + á is 0C 0E). LibRed counted the mark, in both General orders; the rule now lives once, where both write their trailing sections. Measured over 340 keys, both orders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ACE accepts a $ form in a calculated column for the nine VBA functions that have one - LCase, Left, Mid, Right, Space, Str, String, Trim and UCase - and refuses every other: Abs$, IIf$, CDbl$, Year$, InStr$, Len$, Asc$, Round$, Pmt$, IsNull$ and Sgn$ are "cannot be used in a calculated column", measured through DAO. LibRed accepted the $ form of every function on its whitelist, authoring a column ACE cannot read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…does
ACE's DDL works out a DEFAULT when it is declared and refuses one whose
comparison is a type mismatch: IIf('abc' <> False, 1, 0), IIf('0' <> False,
1, 0) and IIf('5' = 5, 1, 0) fail CREATE TABLE, ADD COLUMN and ALTER COLUMN
alike with "Type mismatch". LibRed left them to the insert that applied them.
A CHECK's LIKE was measured to match as a query's does; a DEFAULT's was not,
and the comments no longer say it was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Variant tests failed when ACE or LibRed refused a query until they moved onto the shared parity harness, which counts a refusal on both sides as a match. They ask it not to again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The UCase and LCase cases over the ChrW sample move to the class that asks what a calculated column refuses, ChrW among it, with the sample itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CByte, and Max or Min over it, is declared a Byte for the cast it stands for but holds an Integer, as ACE's does, so where it is an operand it counts as that Integer: -CByte(7) is an Integer, where a Byte column still negates to a Long. LibRed computed the Integer and declared a Long. The date parts, Asc, AscW, Sgn and the negation of an Integer, a Boolean, a Yes/No column, a Long and text are now checked against ACE for their column types, and the negation's value types are pinned on their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The calculated-column matrix let ACE's "0" stand against LibRed's "-0" on every engine, so on Microsoft 365, which writes "-0" as LibRed does, a change in what it writes would have gone unnoticed. The allowance now holds only where a backtick CHECK shows the engine is older than Microsoft 365. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since a query takes text beside an uncomputed number as a type mismatch, the list at CalculatedEvaluator.Unary no longer said what differs: a query takes a column as written where a calculated column computes it, a written number beside written text is a type mismatch in both, and an IIf takes the kind of the arm it chooses in both. The query's predicate for that rule is renamed TakenAsWritten, so it no longer reads as the opposite of NotWritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sKinds pair ServiceWritten in the query's CompareAsKinds and CalculatedEvaluator.Written are one rule over two trees, kept twice by decision. Both sites and CLAUDE.md now say so, so a change to one is made to the other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Whether ACE frees a calculated Memo's old result pages at once when an UPDATE recomputes it is not measured, so it leaves the usage-map spec and becomes a backlog entry with how to settle it. Also drops a summary line left orphaned above the accepted-function list, and a test comment's account of what LibRed once did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A whole-file comparison against ACE: a calculated Memo whose result is a long value, recomputed by UPDATEs of its input, and beside it a plain Memo written the same values. After the UPDATEs the files are byte-identical, so the old result's pages, a chained one's and a packed page it empties, are freed as ACE frees them; the usage-map spec now says so and the backlog entry is settled. The INSERT that follows differs for the calculated column only: ACE does not take the page the old result emptied and extends the file, where LibRed takes it. That case is kept as an open, explicit test, and the spec lists it among LibRed's differences from ACE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A column's properties sit in an LvProp block named for the column, and the name need not be spelt as the table stores it: LibRed once wrote it as a statement typed it. Since owners were matched exactly, such a file's defaults, Required and AllowZeroLength were lost. Measured against ACE with owners respelt in its own files, ACE matches two ways. A row write finds DefaultValue, Required and AllowZeroLength by the database's collation with trailing spaces counted: case, width, kana type and ß for ss fold; a long s, a soft hyphen and a space more or fewer at the end do not, and a column's name can end in spaces. Two blocks naming one column merge, the later DefaultValue winning. A calculated column's Expression, and ALTER COLUMN, DROP COLUMN and a rename, find the block by ACE's case table, and the DDL keeps the owner's spelling: a changed property goes into the block found. The case-table comparison is TextFold.SameName, which QueryExecutor's matching of two calls now uses in place of its own copy, and the trailing-space count is JetTextComparer.TrailingSpaces, shared with StrComp's tie-break. Some pairs of blocks make ACE refuse every insert; which pairs is not settled, LibRed merges them all, and the backlog records how to settle it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Of the 406 orders DAO creates, LibRed refused six. Irish 1084 ACE cannot write in either, refusing every insert. The other five are neutral LANGIDs ACE indexes in, each byte-identical to an order LibRed already encodes: zh-Hans (4) takes Chinese Traditional's stroke order, not Simplified's; ja (17) and ko (18) take Japanese and Korean; zh (30724) and zh-Hant (31748) take General v0. The three that name a CJK table are aliases, and an alias is now looked up as the order it names before either the tailorings or the CJK tables are asked, in place of copying each alias's tailoring into the table at start-up, which could not reach a CJK table. The two General ones join GeneralV0. Each carries the code page ACE writes for it, so a database can be created in it, and the creation test, which has ACE index a LibRed-created file and compares the keys, now runs them over the full CJK sample set: 422 configurations in all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured against ACE through OLE DB, ODBC and DAO. ALTER COLUMN … NOT NULL sets a Required the column already carries where it stands, to 1 and with the DDL flag, and appends one otherwise; a DEFAULT, by ALTER COLUMN … DEFAULT or SET DEFAULT, replaces the existing one in its place. ACE's own ALTER COLUMN … NULL changes nothing, and no SQL statement clears a Required; DAO's Field.Required = False sets it to 0 where it stands. LibRed's NULL writes what DAO does, so the statement makes the column nullable and ACE reads it so. A mutation that touches no property writes nothing. CREATE TABLE, ADD COLUMN and ALTER COLUMN now read a column's DEFAULT, NULL and NOT NULL through one routine, as ACE takes them in each: of two DEFAULTs the last value is kept in the first one's place; NOT NULL ahead of the DEFAULT writes Required first; and ACE's syntax errors are raised with its messages — NULL and NOT NULL side by side ahead of the DEFAULT, NOT NULL twice, and a NULL after the DEFAULT (any in CREATE TABLE and ALTER COLUMN, in ADD COLUMN only one that another NULL or NOT NULL follows). One writer puts a new column's DefaultValue and Required in their declared order for CREATE TABLE and ADD COLUMN alike, and one helper replaces a property in place for the Required, DefaultValue and NameMap writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CByte now returns a VbaByte: the Byte column a query reports, and the Integer it is to ACE as an operand and when stored (CByte(1) into a binary column is 01 00; a GUID column refuses it). Byte + byte keeps its byte type in both EF translators. A value compared with a Yes/No column is taken by its truth where ACE looks the Yes/No column's rows up, and as a number elsewhere, on a minimum set of rules: - A derived table's column is the expression it projects, as ACE merges derived tables (filtered, TOP, grouped and nested ones; not DISTINCT or set operations). On an outer join's padded side LibRed gives Null where ACE keeps the constant, because EF needs it (README). - IN: a column by truth unless the body is correlated; a written value by truth where the Yes/No column leads an index; a computed one where that index is read beside the body's conditions; a parameter never. - EXISTS: a computed value is compared as written where the lookup reads no index for it; a grouped body is no lookup. - Joins: by truth where the Yes/No table is the inner one - through an index leading the column, the optional side of an outer join, or else the side ACE expects more rows of, on a tie the first in FROM. A value written into the statement is truth only through an index. The inner table comes from ACE's row estimate of each input, measured on tables of 1 to 20,000 rows. A restriction an index answers is a term keeping R*k rows (a bound 1/4, an equality 1/distinct keys, IN that many, a closed range 1/128, OR a + b - ab/R), floored at 2; terms combine as their product over R; without one, a single bound keeps 1/4 and any other condition 1/32. GROUP BY keeps an eighth, a set operation the sum. Restricted gives way to this estimator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each change was measured against ACE 16 on the same statements.
- ALTER COLUMN applies a column's PRIMARY KEY, UNIQUE and REFERENCES, as ADD COLUMN does, through the same
key paths; they were parsed and dropped.
- CREATE VIEW binds its query before storing it, so a view over a missing table, join or subquery source is
refused with ACE's message, and a column list names the view's columns (refused when its length is wrong).
- CREATE TABLE refuses a second PRIMARY KEY declaration ("Primary key already exists.") instead of merging it
into a composite key.
- A scalar subquery, or an IN / quantified comparison's subquery, that names more than one field is refused at
bind time with ACE's message.
- `SELECT …; UNION SELECT …` reaches the engine as one statement: the ADO splitter carries a fragment over when
the next one starts with a set operator, as it does for PARAMETERS.
- A calculated column reports its declared result type (a Yes/No column is Boolean, not Int16).
- IF … THEN EXECUTE runs the procedure: EXECUTE is routed with the other statements.
- An out-of-range DEFAULT says "Overflow" (or "Type mismatch", where ACE does), an ambiguous joined DELETE says
"Specify the table containing the records you want to delete.", and a UNION view "Unions not allowed in a
subquery.".
- Corrected stale text: the CREATE VIEW grammar comment, the README's column-level CHECK entry, and the
InsertSelectTests header.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…store calculated Decimals as ACE does Each change was measured against ACE (Microsoft 365) and DAO, and against a column Access's designer created. - A DATETIME2 column's descriptor byte 0x0C is its fractional precision. Access writes 7; ACE's SQL DDL and DAO's CreateField write 0, and ACE's UPDATE and DAO's AddNew/Edit store in that precision, so a 0 there drops every fraction they write. LibRed now creates every DATETIME2 column with Access's 7, reads the byte into the column's scale and keeps it, and reads 0x0B alone as the language id. - A DATETIME2 value's time field counts units of 10^-precision seconds: precision 0 is whole seconds. It was read as 100-ns ticks whatever the digit said. - An ADO Recordset's AddNew/Update stores OLE DB's 16-byte DBTIMESTAMP in the field instead of the text; it is now read as the date it holds rather than refusing the table. - A calculated Decimal result is cached as OLE Automation's 16-byte VT_DECIMAL in the value's own scale, not a Decimal column's 17 bytes. LibRed now reads it and writes it byte for byte; it refused the table and the write before. - Documented that the VBA conversions propagate Null in a query, deliberately, and keep the VBA rule in a calculated column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…does A column's and a table's ValidationRule are now enforced on INSERT and UPDATE, in ACE's order: Required, field rules, the table rule, then keys and CHECKs. A field rule may leave its column implied. Rules are evaluated against the value as stored, a field rule only for the columns an UPDATE writes, and never on DELETE. A rule naming a missing column is refused. RENAME COLUMN carries the rules over. A refused row stores its long values before the checks run, as ACE does. A failed statement gives the pages its single-page values took back to the session's reservation; chained values and an explicit ROLLBACK keep theirs. A single-page long value of up to 256 bytes goes to the free map's first page, and a larger one only to its last, else to a new page. A bare Now or Rnd, with no parentheses, is a call to the function, so Rnd can be a column default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Renaming an index now moves its property block to the new name, and DROP INDEX, or DROP CONSTRAINT on a primary key, removes the block. A relationship's DROP CONSTRAINT leaves its index's block in place, as ACE does. Renaming a table advances its DateUpdate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Replication ID A page that reaches 255 rows stays in the table's free map until the next insert finds it full and moves on, in ACE as in LibRed. The spec now says so. A Replication ID AutoNumber, as Access's designer makes it, carries column flag 0x40 and a GenGUID() default. The default fills the column, and the flag generates nothing on its own, in ACE as in LibRed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lated columns A #…# literal is now read by ACE's rule rather than .NET's parser: - three numbers are tried as month/day/year, then year/month/day, then day/month/year, so CirrusRedOrg#13/1/2020# is 13 January; - a year below 100 takes the 1950–2049 window however it is written, so CirrusRedOrg#1/1/0009# is 2009; - month names, separators, times and AM/PM are taken or refused as ACE takes them. The machine's culture plays no part. The two-digit window is fixed. The reader lives in one source file compiled into LibRed.Sql and LibRed.Core, so a calculated column's literal now reads as a query's does. The two parsers had already drifted apart: only one put a bare time on day zero. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ral carry a fraction of a second
A #…# literal and text converted to a date (CDate, CVDate, DateValue,
TimeValue, IsDate, text stored into a Date/Time column) are one reading in
ACE: OLE Automation's string-to-date conversion. A literal reads it in US
English and takes no comma; a conversion reads it in the regional settings.
LibRed had two parsers for it, which disagreed with ACE in different places.
They are now one, VbaDateText, in the shared source file both LibRed.Sql
and LibRed.Core already compiled.
Measured against ACE, the merged reading:
- tries three numbers in the regional order, then year/month/day, then
the regional order swapped, so CDate('31/2/1') is 2031-02-01 in en-AU;
- reads two numbers beside a month name as day then year, else year then
day, so '2020 Jan 13' is 13 January 2020;
- takes any prefix of a month name of three letters or more ('Sep',
'Janu') and A or P alone for AM or PM;
- takes a full stop between the parts of a time as a colon, so CirrusRedOrg#13:45.5#
is 13:45:05;
- allows spacing, tabs included, around a date separator, but no date
separator against a time, so CirrusRedOrg#1/13/2020-13:45# is refused.
A literal may also carry a fraction of the second after h:m:s written with
colons, as conversions already could: LibRed keeps sub-second parts, and
its own SQL writes them. ACE refuses it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A stored query is a view only when it is a plain SELECT that declares no parameters; a UNION, a crosstab and every action, data-definition and pass-through query is a procedure (verified vs ACE's OLE DB rowsets). StoredQuery.IsView records that, read from the query's kind, and SchemaRowsets' Views and Procedures take their split from it, so a UNION or crosstab no longer lists as a view. A plain SELECT naming a parameter it does not declare is still listed as a view, where ACE calls it a procedure. The scaffolder now reports views: each one SchemaRowsets lists, with its columns from SchemaRowsets.ViewColumnDefinitions, typed by JetStoreType. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Advance the 11.0.0 prerelease label from beta to rc.
… SQL does A deliberate divergence from ACE. ACE returns such a column as False in the select list, the expressions over it, ORDER BY and DISTINCT, and refuses to group by it, while WHERE and aggregates see the Null. LibRed now gives the Null throughout: the conversion and the GROUP BY refusal are gone, and the Nulls form a group of their own. It is what EF Core reads a LEFT JOIN's bool? as. A view's Yes/No column from that side, or computed from one, is reported nullable in the Columns rowset and scaffolds as bool?, where ACE reports it not nullable. The view column's nullability is decided in one place for the rowset and the scaffolder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A deliberate divergence from ACE. ACE's reader calls every column nullable without KeyInfo, and with it only a single table's primary key not nullable. A reader's AllowDBNull is now the column's declared nullability under every CommandBehavior: a stored column's own (its Required property, an AutoNumber, a Yes/No), a computed one's type's, and nullable wherever an outer join pads the column. A query over a table with NOT NULL columns, a stored procedure's included, reports them not nullable again. The KeyInfo rule and the column provenance it was traced through are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch moves the providers to 11.0.0-rc.1. Most of it holds LibRed's values to ACE's: how a value is compared, converted, typed and stored, what a function returns, how a date is read, and what a stored file looks like afterwards. Queries and calculated columns now share one implementation of every function. Nearly every behaviour change was measured against ACE first, on the same statement, through ACE 2010 or the Microsoft 365 runtime.
Packaging and build
EF Core providers (Jet and shared
EFCore.Jet.Common)Math.SignreadsSGNas the Integer it is. ACE givesSgnVBA's Integer, an Int16 column, whatever its argument. The SQL is unchanged; EF now reads an Int16 and widens it toint.byte + bytekeeps its byte operands. EF Core types the sum as the byte Jet does not return; it is now read as C# types it, in both the Jet and LibRed translators.LibRed EF Core provider and ADO.NET
LibRed.Adoand the scaffolder. The connection string takesPassword, and still reads ACE OLE DB'sJet OLEDB:Database Passwordand ODBC'sPWD;LibRedConnectionStringBuilder.Parseis the one parse every caller uses.bool?.Year()column toshortno longer fails inGetInt16(InvalidCastException: Unable to read System.Int16 column #309).LibRed SQL engine
EXISTS,INor= ANY, or by a comparison an index the column leads answers — is taken by its truth, and elsewhere as a number.col = Trueis a truth test, not answered by an index seek.WHEREcompares a column of its optional table is planned as the inner join it is.IN,BETWEEN,HAVINGand join. ACHECKwith no subquery and aDEFAULTcompare as a calculated column does, since ACE works both out in its expression service; aCHECKwith a subquery compares as a query.BYTE, where it threw.CHECKsees it.ExpressionFunctions, which the query evaluator and the calculated-column evaluator both derive from, so a formula answers the same through SQL and through a calculated column.$function is the String-returning form of its plain name: it raises where the plain name gives Null, and a calculated column accepts exactly the nine$forms ACE accepts.Sgn, and the negation of an Integer or Boolean, are Integers;CByteis a Byte column holding the Integer it is to ACE;Timeris a Single; aDateDiffcount past a Long is a Double.UCase,LCase,StrConvandFormat's<and>case by ACE's own case table;InStr,InStrRevandReplacesearch as ACE does, not by the collation; only ASCII digits are digits;StrConv's result is text.#…#literal and text converted to a date (CDate,DateValue,IsDate, text stored into a Date/Time column) are one reading, OLE Automation's: three numbers in the regional order, then year/month/day, then swapped; a two-digit year in the 1950–2049 window; month-name prefixes and AM/PM as ACE takes them. A literal reads in US English, a conversion in the regional settings, and one parser serves queries and calculated columns. A literal may carry a fraction of a second, which ACE refuses.CHECKreads cannot be dropped, renamed or altered, and ACE names the earliest such check.DEFAULTthat is a type mismatch is refused when it is declared.ALTER COLUMN … NOT NULLandDEFAULTwriteRequiredandDefaultValuewhere ACE does, and the three DDL statements readDEFAULT,NULLandNOT NULLin ACE's order, with its syntax errors.ALTER COLUMNappliesPRIMARY KEY,UNIQUEandREFERENCES;CREATE VIEWbinds its query before storing it; a secondPRIMARY KEYis refused.ValidationRuleare enforced onINSERTandUPDATE, in ACE's order.DELETEruns in ACE's sequence acrossCASCADE,SET NULLandNO ACTION, depth first, and no row goes until every check has passed. An unnamed foreign key is namedRel_and part of a GUID, as ACE names it.LibRed file format
.mdbis refused without its password, as ACE refuses it with "Not a valid password."; the password was never checked.UPDATEwrites every column itsSETnames, not only those whose value changed.VT_DECIMAL.DATETIME2is created with Access's fractional precision of 7 and read in every stored form, a precision of 0 and ADO'sDBTIMESTAMPincluded.WITH IGNORE NULLindex leaves out only a key that is Null in every column.0x0200.Required.Tests and CI
"0"for a negative zero only on an engine older than Microsoft 365.Docs
src/LibRed/docs/format): aligned with the code in a cross-check, and updated with each measurement above;docs/int64-values.mdrecords which Int64 bindings work through OLE DB, ODBC and DAO on each engine.CLAUDE.md/AGENTS.md: one copy of every function is a hard rule, with the two duplicates kept by decision marked at both sites.🤖 Generated with Claude Code